/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package slideshow;

import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import javax.imageio.ImageIO;

/**
 *
 * @author Andrea
 */
public class ListImages {
    
    private LinkedList <Image> llList;
    
    public ListImages ( String asPath ) throws IOException {
        
        llList = new LinkedList <Image> ();
        
        this.fpLoadImage ( asPath );
        
    }
    
    private LinkedList fpLoadImage ( String asPath ) throws IOException {
        
        File lfFile = new File ( asPath );
        String [ ]  lsListFiles = lfFile.list();
        
        for ( int i = 0; i < lsListFiles.length; i ++ ) {
                
            File file = new File ( asPath + lsListFiles [ i ] );
            llList.add( ImageIO.read ( file ) );

        }
        
            return llList;
        
    } 
    
    public Image fnGetImageAtIndexOf ( int aiIndex ) {
        
        Image liImage = (Image) llList.get ( aiIndex );
        
            return liImage;
        
    }
    
    public int fnGetNumerOfListItems ( ) {
        
            return llList.size();
        
    }
    
} 
